<?php

declare(strict_types=1);

namespace App\Fastapp\Model;

use Hyperf\Database\Model\SoftDeletes;
use Mine\MineModel;

/**
 * @property int $id 主键
 * @property \Carbon\Carbon $created_at 创建时间
 * @property \Carbon\Carbon $updated_at 更新时间
 * @property string $deleted_at 删除时间
 * @property int $code 国家数字代码
 * @property int $type 证件类型1身份证2护照3驾照4其他
 * @property int $status 0未核验1通过2拒绝
 * @property string $id_no 号码
 * @property string $surname 姓氏
 * @property string $name 姓名
 * @property int $gender 性别1男2女
 * @property string $birthday 生日
 * @property string $nation 民族
 * @property string $address 住址
 * @property string $issuing_authority 发证机关
 * @property string $start_at 开始时间
 * @property string $end_at 结束时间
 * @property int $forever 永久有效1是2否
 * @property mixed|string $id_card_front 正面
 * @property mixed|string $id_card_back 反面
 */
class FastappRealname extends MineModel
{
    use SoftDeletes, FileTrait;

    /**
     * The table associated with the model.
     */
    protected ?string $table = 'fastapp_realname';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'created_at', 'updated_at', 'deleted_at', 'code', 'type', 'status', 'id_no', 'surname', 'name', 'gender', 'birthday', 'nation', 'address', 'issuing_authority', 'start_at', 'end_at', 'forever', 'id_card_front', 'id_card_back'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime', 'code' => 'integer', 'type' => 'integer', 'status' => 'integer', 'gender' => 'integer', 'forever' => 'integer'];

    public function setIdCardFrontAttribute($value): void
    {
        $this->formatPathSet('id_card_front', $value);
    }

    public function getIdCardFrontAttribute($value): string
    {
        return $this->formatPathGet($value);
    }

    public function setIdCardBackAttribute($value): void
    {
        $this->formatPathSet('id_card_back', $value);
    }

    public function getIdCardBackAttribute($value): string
    {
        return $this->formatPathGet($value);
    }
}
